package com.yj.suncity.activity.shouye;

import com.yj.suncity.R;
import com.yj.suncity.constant.URLCon;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.widget.TextView;

public class ProductDetailWebActivity extends Activity implements
		OnClickListener {
	private WebView view;
	private Context context;
	private String content;

	@SuppressLint("NewApi")
	@Override
	protected void onCreate(Bundle savedInstanceState) {

		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_detail_webview);
		context = this;
		content = getIntent().getStringExtra("content");
		findView();
	}

	private void findView() {

		((TextView) findViewById(R.id.txt_title_name)).setText("详情");

		findViewById(R.id.btnHeadBack).setOnClickListener(this);
		view = (WebView) findViewById(R.id.webView1);
		WebSettings settings = view.getSettings();
		settings.setUseWideViewPort(false);// 设置webview 推荐使用的串口。
		settings.setLoadWithOverviewMode(true);// 设置webview加载页面的方式
		settings.setJavaScriptEnabled(true);// 要与javascript交互
		// settings.setAllowFileAccess(true);//要访问本地文件
		settings.setSupportZoom(true);
		// settings.setBuiltInZoomControls(true);
		// view.setInitialScale(39);
		view.setBackgroundColor(0);// 设置透明颜色
		settings.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

		view.loadDataWithBaseURL(URLCon.HOST, content, "text/html", "utf-8", "");

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btnHeadBack:
			this.finish();
			break;

		default:
			break;
		}

	}

}
